﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-language" content="en" />

<link href="jquery.zrssfeed.css" rel="stylesheet" type="text/css" />

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="jquery.zrssfeed.min.js" type="text/javascript"></script>

<title>zRSSFeed - How to limit feed title lengths</title>

<script type="text/javascript">
$(document).ready(function () {
	$('#test').rssfeed('http://feeds.reuters.com/reuters/oddlyEnoughNews',{},function(e) {
		$('h4 a',e).each(function(i) {
			var title = $(this).text();
			if (title.length > 14) $(this).text(title.substring(0,14)+'...');
		});
	});
});
</script>

</head>
<body>

<h1>zRSSFeed - How to limit feed title lengths</h1>
<p>This example shows how to manipulate the feed after it has been loaded by using the callback function. In this case, if the feed title is over 14 characters it is truncated and periods added to indicate the title is incomplete.</p>

<h4>Script</h4>
<pre>
$(document).ready(function () {
	$('#test').rssfeed('http://feeds.reuters.com/reuters/oddlyEnoughNews',{},function(e) {

		$('h4 a',e).each(function(i) {

			var title = $(this).text();
			if (title.length > 14) $(this).text(title.substring(0,14)+'...');
		});
	});
});
</pre>

<h4>Result</h4>
<div id="test"></div>

</body>
</html>